package com.sise.rsc.repository;

import com.sise.rsc.entity.Task;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface TaskRepository extends JpaRepository<Task,Integer> {

    @Query(" from Task t where t.courier.no=?1 and t.state != ?2")
    List<Task> findAllByCourierNoAndNoState(String no,int state);

    @Query("from Task t WHERE t.aPackage.no=?1 and t.taskName=?2")
    Task findTaskByTaskNameAndAPackageNo(String taskName,String pNo);

    @Query("from Task t WHERE t.aPackage.no=?1 and  t.state=?2 and t.taskName=?3")
    Task findTaskByTaskNameAndStateAndAPackageNo(String pNo ,int state,String taskName);
}
